package at.falb.games.alcatraz.api.client;

import java.rmi.RemoteException;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import at.falb.games.alcatraz.api.common.PlayerUnit;

public abstract class DummyImpl extends UnicastRemoteObject {

	private static final long serialVersionUID = 672517734943312692L;

	protected DummyImpl() throws RemoteException {
		super();
	}

	public DummyImpl(int port) throws RemoteException {
		super(port);
	}

	public DummyImpl(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
		super(port, csf, ssf);
	}

	protected PlayerUnit createDummyPlayer(String playerName) {
		return "Player1".equals(playerName) ?
			new PlayerUnit(0, new Timestamp(new Date().getTime()), "Player1", null):
			new PlayerUnit(1, new Timestamp(new Date().getTime()), "Player2", null);
	}

	protected List<PlayerUnit> getDummyPlayerList(PlayerUnit player) {
		List<PlayerUnit> players = new ArrayList<PlayerUnit>();
		players.add(new PlayerUnit(0, new Timestamp(new Date().getTime()), "Player1", null));
		players.add(new PlayerUnit(1, new Timestamp(new Date().getTime()), "Player2", null));
//		players.add(new PlayerUnit(3, new Timestamp(new Date().getTime()), "Player3", null));
		return players;
	}

}
